home *** CD-ROM | disk | FTP | other *** search
/ Risc World 5 / Risc World 5.iso / SOFTWARE / Issue3 / Games / xrick / !xrick / Makefile < prev    next >
Makefile  |  2002-12-24  |  2KB  |  90 lines

  1. #
  2. # xrick/Makefile
  3. #
  4. # Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved.
  5. #
  6. # The use and distribution terms for this software are contained in the file
  7. # named README, which can be found in the root of this distribution. By
  8. # using this software in any fashion, you are agreeing to be bound by the
  9. # terms of this license.
  10. #
  11. # You must not remove this notice, or any other, from this software.
  12. #
  13.  
  14. #
  15. # Vars
  16. #
  17.  
  18. SDLVERSION=$(shell sdl-config --version 2>/dev/null)
  19. ROOTDIR=$(shell pwd)
  20. TARGET=$(shell uname -s | tr [a-z] [A-Z])
  21.  
  22. #
  23. # Config
  24. #
  25.  
  26. ifeq ($(strip $(SDLVERSION)),) 
  27. $(error SDL is missing) 
  28. else 
  29. $(warning Detected SDL version $(SDLVERSION)) 
  30. endif
  31.  
  32. ifeq ($(strip $(SDLVERSION)),)
  33. $(error SDL is missing)
  34. endif
  35.  
  36. SDL_MAJ=$(word 1,$(subst ., ,$(SDLVERSION)))
  37. SDL_MIN=$(word 2,$(subst ., ,$(SDLVERSION)))
  38. SDL_MIC=$(word 3,$(subst ., ,$(SDLVERSION)))
  39.  
  40. SDL_MAJ_REQ=1
  41. SDL_MIN_REQ=2
  42. SDL_MIC_REQ=1
  43.  
  44. SDL_CHKVER=$(shell if [ $(SDL_MAJ) -lt $(SDL_MAJ_REQ) ]; then echo "BAD"; fi)
  45. ifeq ($(SDL_CHKVER),BAD)
  46. $(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required)
  47. endif
  48.  
  49. SDL_CHKVER=$(shell if [ $(SDL_MAJ) -eq $(SDL_MAJ_REQ) -a $(SDL_MIN) -lt $(SDL_MIN_REQ) ]; then echo "BAD"; fi)
  50. ifeq ($(SDL_CHKVER),BAD)
  51. $(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required)
  52. endif
  53.  
  54. SDL_CHKVER=$(shell if [ $(SDL_MAJ) -eq $(SDL_MAJ_REQ) -a $(SDL_MIN) -eq $(SDL_MIN_REQ) -a $(SDL_MIC) -lt $(SDL_MIC_REQ) ]; then echo "BAD"; fi)
  55. ifeq ($(SDL_CHKVER),BAD)
  56. $(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required)
  57. endif
  58.  
  59. ifneq (,$(findstring CYGWIN,$(TARGET)))
  60. XOBJ=xrick.res
  61. endif
  62.  
  63. ifneq (,$(findstring MINGW,$(TARGET)))
  64. XOBJ=xrick.res
  65. endif
  66.  
  67. #
  68. # Rules
  69. #
  70.  
  71. all:
  72.     @echo "ROOTDIR=$(ROOTDIR)" > Makefile.global
  73.     @echo "XOBJ=$(XOBJ)" >> Makefile.global
  74.     @echo "CFLAGS=-g -ansi -pedantic -Wall -W -O2 -I $(ROOTDIR)/include $(shell sdl-config --cflags)" >> Makefile.global
  75.     @echo "LDFLAGS=-lz $(shell sdl-config --libs)" >> Makefile.global
  76.     @echo "CC=gcc" >> Makefile.global
  77.     @echo "CPP=gcc -E" >> Makefile.global
  78.     $(MAKE) -C src all
  79.  
  80. clean:
  81.     for i in src include; do \
  82.       $(MAKE) -C $$i clean; \
  83.     done
  84.     rm -f *~ log.txt Makefile.global
  85.  
  86. depend:
  87.     $(MAKE) -C src depend
  88.  
  89. # eof
  90.